1 module directx.d3d7; 2 3 version(Windows): 4 version(Direct3D_7): 5 6 import directx.win32; 7 import directx.com; 8 import directx.d3dcommon; 9 10 enum DD_ROP_SPACE = 256 / 32; 11 12 struct DDSCAPS { 13 DWORD dwCaps; // capabilities of surface wanted 14 } 15 alias LPDDSCAPS = DDSCAPS*; 16 17 enum { 18 DDSD_CAPS = 0x00000001, 19 DDSD_HEIGHT = 0x00000002, 20 DDSD_WIDTH = 0x00000004, 21 DDSD_PITCH = 0x00000008, 22 DDSD_BACKBUFFERCOUNT = 0x00000020, 23 DDSD_ZBUFFERBITDEPTH = 0x00000040, 24 DDSD_ALPHABITDEPTH = 0x00000080, 25 DDSD_LPSURFACE = 0x00000800, 26 DDSD_PIXELFORMAT = 0x00001000, 27 DDSD_CKDESTOVERLAY = 0x00002000, 28 DDSD_CKDESTBLT = 0x00004000, 29 DDSD_CKSRCOVERLAY = 0x00008000, 30 DDSD_CKSRCBLT = 0x00010000, 31 DDSD_MIPMAPCOUNT = 0x00020000, 32 DDSD_REFRESHRATE = 0x00040000, 33 DDSD_LINEARSIZE = 0x00080000, 34 DDSD_TEXTURESTAGE = 0x00100000, 35 DDSD_FVF = 0x00200000, 36 DDSD_SRCVBHANDLE = 0x00400000, 37 DDSD_DEPTH = 0x00800000, 38 DDSD_ALL = 0x00fff9ee 39 } 40 41 enum { 42 DDSCAPS_RESERVED1 = 0x00000001, 43 DDSCAPS_ALPHA = 0x00000002, 44 DDSCAPS_BACKBUFFER = 0x00000004, 45 DDSCAPS_COMPLEX = 0x00000008, 46 DDSCAPS_FLIP = 0x00000010, 47 DDSCAPS_FRONTBUFFER = 0x00000020, 48 DDSCAPS_OFFSCREENPLAIN = 0x00000040, 49 DDSCAPS_OVERLAY = 0x00000080, 50 DDSCAPS_PALETTE = 0x00000100, 51 DDSCAPS_PRIMARYSURFACE = 0x00000200, 52 DDSCAPS_RESERVED3 = 0x00000400, 53 DDSCAPS_PRIMARYSURFACELEFT = 0x00000000, 54 DDSCAPS_SYSTEMMEMORY = 0x00000800, 55 DDSCAPS_TEXTURE = 0x00001000, 56 DDSCAPS_3DDEVICE = 0x00002000, 57 DDSCAPS_VIDEOMEMORY = 0x00004000, 58 DDSCAPS_VISIBLE = 0x00008000, 59 DDSCAPS_WRITEONLY = 0x00010000, 60 DDSCAPS_ZBUFFER = 0x00020000, 61 DDSCAPS_OWNDC = 0x00040000, 62 DDSCAPS_LIVEVIDEO = 0x00080000, 63 DDSCAPS_HWCODEC = 0x00100000, 64 DDSCAPS_MODEX = 0x00200000, 65 DDSCAPS_MIPMAP = 0x00400000, 66 DDSCAPS_RESERVED2 = 0x00800000, 67 DDSCAPS_ALLOCONLOAD = 0x04000000, 68 DDSCAPS_VIDEOPORT = 0x08000000, 69 DDSCAPS_LOCALVIDMEM = 0x10000000, 70 DDSCAPS_NONLOCALVIDMEM = 0x20000000, 71 DDSCAPS_STANDARDVGAMODE = 0x40000000, 72 DDSCAPS_OPTIMIZED = 0x80000000, 73 DDSCAPS2_RESERVED4 = 0x00000002, 74 DDSCAPS2_HARDWAREDEINTERLACE = 0x00000000, 75 DDSCAPS2_HINTDYNAMIC = 0x00000004, 76 DDSCAPS2_HINTSTATIC = 0x00000008, 77 DDSCAPS2_TEXTUREMANAGE = 0x00000010, 78 DDSCAPS2_RESERVED1 = 0x00000020, 79 DDSCAPS2_RESERVED2 = 0x00000040, 80 DDSCAPS2_OPAQUE = 0x00000080, 81 DDSCAPS2_HINTANTIALIASING = 0x00000100, 82 DDSCAPS2_CUBEMAP = 0x00000200, 83 DDSCAPS2_CUBEMAP_POSITIVEX = 0x00000400, 84 DDSCAPS2_CUBEMAP_NEGATIVEX = 0x00000800, 85 DDSCAPS2_CUBEMAP_POSITIVEY = 0x00001000, 86 DDSCAPS2_CUBEMAP_NEGATIVEY = 0x00002000, 87 DDSCAPS2_CUBEMAP_POSITIVEZ = 0x00004000, 88 DDSCAPS2_CUBEMAP_NEGATIVEZ = 0x00008000, 89 DDSCAPS2_CUBEMAP_ALLFACES = DDSCAPS2_CUBEMAP_POSITIVEX | 90 DDSCAPS2_CUBEMAP_NEGATIVEX | 91 DDSCAPS2_CUBEMAP_POSITIVEY | 92 DDSCAPS2_CUBEMAP_NEGATIVEY | 93 DDSCAPS2_CUBEMAP_POSITIVEZ | 94 DDSCAPS2_CUBEMAP_NEGATIVEZ, 95 DDSCAPS2_MIPMAPSUBLEVEL = 0x00010000, 96 DDSCAPS2_D3DTEXTUREMANAGE = 0x00020000, 97 DDSCAPS2_DONOTPERSIST = 0x00040000, 98 DDSCAPS2_STEREOSURFACELEFT = 0x00080000, 99 DDSCAPS2_VOLUME = 0x00200000, 100 DDSCAPS2_NOTUSERLOCKABLE = 0x00400000, 101 DDSCAPS2_POINTS = 0x00800000, 102 DDSCAPS2_RTPATCHES = 0x01000000, 103 DDSCAPS2_NPATCHES = 0x02000000, 104 DDSCAPS2_RESERVED3 = 0x04000000, 105 DDSCAPS2_DISCARDBACKBUFFER = 0x10000000, 106 DDSCAPS2_ENABLEALPHACHANNEL = 0x20000000, 107 DDSCAPS2_EXTENDEDFORMATPRIMARY = 0x40000000, 108 DDSCAPS2_ADDITIONALPRIMARY = 0x80000000, 109 DDSCAPS3_MULTISAMPLE_MASK = 0x0000001F, 110 DDSCAPS3_MULTISAMPLE_QUALITY_MASK = 0x000000E0, 111 DDSCAPS3_MULTISAMPLE_QUALITY_SHIFT = 5, 112 DDSCAPS3_RESERVED1 = 0x00000100, 113 DDSCAPS3_RESERVED2 = 0x00000200, 114 DDSCAPS3_LIGHTWEIGHTMIPMAP = 0x00000400, 115 DDSCAPS3_AUTOGENMIPMAP = 0x00000800, 116 DDSCAPS3_DMAP = 0x00001000, 117 118 /* D3D9Ex only -- */ 119 DDSCAPS3_CREATESHAREDRESOURCE = 0x00002000, 120 DDSCAPS3_READONLYRESOURCE = 0x00004000, 121 DDSCAPS3_OPENSHAREDRESOURCE = 0x00008000 122 } 123 124 struct DDCAPS_DX7 { 125 /* 0*/ DWORD dwSize; // size of the DDDRIVERCAPS structure 126 /* 4*/ DWORD dwCaps; // driver specific capabilities 127 /* 8*/ DWORD dwCaps2; // more driver specific capabilites 128 /* c*/ DWORD dwCKeyCaps; // color key capabilities of the surface 129 /* 10*/ DWORD dwFXCaps; // driver specific stretching and effects capabilites 130 /* 14*/ DWORD dwFXAlphaCaps; // alpha driver specific capabilities 131 /* 18*/ DWORD dwPalCaps; // palette capabilities 132 /* 1c*/ DWORD dwSVCaps; // stereo vision capabilities 133 /* 20*/ DWORD dwAlphaBltConstBitDepths; // DDBD_2,4,8 134 /* 24*/ DWORD dwAlphaBltPixelBitDepths; // DDBD_1,2,4,8 135 /* 28*/ DWORD dwAlphaBltSurfaceBitDepths; // DDBD_1,2,4,8 136 /* 2c*/ DWORD dwAlphaOverlayConstBitDepths; // DDBD_2,4,8 137 /* 30*/ DWORD dwAlphaOverlayPixelBitDepths; // DDBD_1,2,4,8 138 /* 34*/ DWORD dwAlphaOverlaySurfaceBitDepths; // DDBD_1,2,4,8 139 /* 38*/ DWORD dwZBufferBitDepths; // DDBD_8,16,24,32 140 /* 3c*/ DWORD dwVidMemTotal; // total amount of video memory 141 /* 40*/ DWORD dwVidMemFree; // amount of free video memory 142 /* 44*/ DWORD dwMaxVisibleOverlays; // maximum number of visible overlays 143 /* 48*/ DWORD dwCurrVisibleOverlays; // current number of visible overlays 144 /* 4c*/ DWORD dwNumFourCCCodes; // number of four cc codes 145 /* 50*/ DWORD dwAlignBoundarySrc; // source rectangle alignment 146 /* 54*/ DWORD dwAlignSizeSrc; // source rectangle byte size 147 /* 58*/ DWORD dwAlignBoundaryDest; // dest rectangle alignment 148 /* 5c*/ DWORD dwAlignSizeDest; // dest rectangle byte size 149 /* 60*/ DWORD dwAlignStrideAlign; // stride alignment 150 /* 64*/ DWORD[DD_ROP_SPACE] dwRops; // ROPS supported 151 /* 84*/ DDSCAPS ddsOldCaps; // Was DDSCAPS ddsCaps. ddsCaps is of type DDSCAPS2 for DX6 152 /* 88*/ DWORD dwMinOverlayStretch; // minimum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 153 /* 8c*/ DWORD dwMaxOverlayStretch; // maximum overlay stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 154 /* 90*/ DWORD dwMinLiveVideoStretch; // minimum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 155 /* 94*/ DWORD dwMaxLiveVideoStretch; // maximum live video stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 156 /* 98*/ DWORD dwMinHwCodecStretch; // minimum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 157 /* 9c*/ DWORD dwMaxHwCodecStretch; // maximum hardware codec stretch factor multiplied by 1000, eg 1000 == 1.0, 1300 == 1.3 158 /* a0*/ DWORD dwReserved1; // reserved 159 /* a4*/ DWORD dwReserved2; // reserved 160 /* a8*/ DWORD dwReserved3; // reserved 161 /* ac*/ DWORD dwSVBCaps; // driver specific capabilities for System->Vmem blts 162 /* b0*/ DWORD dwSVBCKeyCaps; // driver color key capabilities for System->Vmem blts 163 /* b4*/ DWORD dwSVBFXCaps; // driver FX capabilities for System->Vmem blts 164 /* b8*/ DWORD[DD_ROP_SPACE] dwSVBRops;// ROPS supported for System->Vmem blts 165 /* d8*/ DWORD dwVSBCaps; // driver specific capabilities for Vmem->System blts 166 /* dc*/ DWORD dwVSBCKeyCaps; // driver color key capabilities for Vmem->System blts 167 /* e0*/ DWORD dwVSBFXCaps; // driver FX capabilities for Vmem->System blts 168 /* e4*/ DWORD[DD_ROP_SPACE] dwVSBRops;// ROPS supported for Vmem->System blts 169 /*104*/ DWORD dwSSBCaps; // driver specific capabilities for System->System blts 170 /*108*/ DWORD dwSSBCKeyCaps; // driver color key capabilities for System->System blts 171 /*10c*/ DWORD dwSSBFXCaps; // driver FX capabilities for System->System blts 172 /*110*/ DWORD[DD_ROP_SPACE] dwSSBRops;// ROPS supported for System->System blts 173 /*130*/ DWORD dwMaxVideoPorts; // maximum number of usable video ports 174 /*134*/ DWORD dwCurrVideoPorts; // current number of video ports used 175 /*138*/ DWORD dwSVBCaps2; // more driver specific capabilities for System->Vmem blts 176 /*13c*/ DWORD dwNLVBCaps; // driver specific capabilities for non-local->local vidmem blts 177 /*140*/ DWORD dwNLVBCaps2; // more driver specific capabilities non-local->local vidmem blts 178 /*144*/ DWORD dwNLVBCKeyCaps; // driver color key capabilities for non-local->local vidmem blts 179 /*148*/ DWORD dwNLVBFXCaps; // driver FX capabilities for non-local->local blts 180 /*14c*/ DWORD[DD_ROP_SPACE] dwNLVBRops; // ROPS supported for non-local->local blts 181 // Members added for DX6 release 182 /*16c*/ DDSCAPS2 ddsCaps; // Surface Caps 183 } 184 alias LPDDCAPS_DX7 = DDCAPS_DX7*; 185 186 alias DDCAPS = DDCAPS_DX7; 187 alias LPDDCAPS = LPDDCAPS_DX7; 188 189 struct DDCOLORKEY { 190 DWORD dwColorSpaceLowValue; // low boundary of color space that is to 191 // be treated as Color Key, inclusive 192 DWORD dwColorSpaceHighValue; // high boundary of color space that is 193 // to be treated as Color Key, inclusive 194 } 195 alias LPDDCOLORKEY = DDCOLORKEY*; 196 197 enum MAX_DDDEVICEID_STRING = 512; 198 199 struct DDDEVICEIDENTIFIER2 { 200 /* 201 * These elements are for presentation to the user only. They should not be used to identify particular 202 * drivers, since this is unreliable and many different strings may be associated with the same 203 * device, and the same driver from different vendors. 204 */ 205 char[MAX_DDDEVICEID_STRING] szDriver; 206 char[MAX_DDDEVICEID_STRING] szDescription; 207 208 /* 209 * This element is the version of the DirectDraw/3D driver. It is legal to do <, > comparisons 210 * on the whole 64 bits. Caution should be exercised if you use this element to identify problematic 211 * drivers. It is recommended that guidDeviceIdentifier is used for this purpose. 212 * 213 * This version has the form: 214 * wProduct = HIWORD(liDriverVersion.HighPart) 215 * wVersion = LOWORD(liDriverVersion.HighPart) 216 * wSubVersion = HIWORD(liDriverVersion.LowPart) 217 * wBuild = LOWORD(liDriverVersion.LowPart) 218 */ 219 // #ifdef _WIN32 220 LARGE_INTEGER liDriverVersion; /* Defined for applications and other 32 bit components */ 221 // #else 222 // DWORD dwDriverVersionLowPart; /* Defined for 16 bit driver components */ 223 // DWORD dwDriverVersionHighPart; 224 // #endif 225 226 227 /* 228 * These elements can be used to identify particular chipsets. Use with extreme caution. 229 * dwVendorId Identifies the manufacturer. May be zero if unknown. 230 * dwDeviceId Identifies the type of chipset. May be zero if unknown. 231 * dwSubSysId Identifies the subsystem, typically this means the particular board. May be zero if unknown. 232 * dwRevision Identifies the revision level of the chipset. May be zero if unknown. 233 */ 234 DWORD dwVendorId; 235 DWORD dwDeviceId; 236 DWORD dwSubSysId; 237 DWORD dwRevision; 238 239 /* 240 * This element can be used to check changes in driver/chipset. This GUID is a unique identifier for the 241 * driver/chipset pair. Use this element if you wish to track changes to the driver/chipset in order to 242 * reprofile the graphics subsystem. 243 * This element can also be used to identify particular problematic drivers. 244 */ 245 GUID guidDeviceIdentifier; 246 247 /* 248 * This element is used to determine the Windows Hardware Quality Lab (WHQL) 249 * certification level for this driver/device pair. 250 */ 251 DWORD dwWHQLLevel; 252 } 253 alias LPDDDEVICEIDENTIFIER2 = DDDEVICEIDENTIFIER2*; 254 255 struct DDPIXELFORMAT { 256 DWORD dwSize; // size of structure 257 DWORD dwFlags; // pixel format flags 258 DWORD dwFourCC; // (FOURCC code) 259 union { 260 DWORD dwRGBBitCount; // how many bits per pixel 261 DWORD dwYUVBitCount; // how many bits per pixel 262 DWORD dwZBufferBitDepth; // how many total bits/pixel in z buffer (including any stencil bits) 263 DWORD dwAlphaBitDepth; // how many bits for alpha channels 264 DWORD dwLuminanceBitCount; // how many bits per pixel 265 DWORD dwBumpBitCount; // how many bits per "buxel", total 266 DWORD dwPrivateFormatBitCount;// Bits per pixel of private driver formats. Only valid in texture 267 // format list and if DDPF_D3DFORMAT is set 268 } 269 union { 270 DWORD dwRBitMask; // mask for red bit 271 DWORD dwYBitMask; // mask for Y bits 272 DWORD dwStencilBitDepth; // how many stencil bits (note: dwZBufferBitDepth-dwStencilBitDepth is total Z-only bits) 273 DWORD dwLuminanceBitMask; // mask for luminance bits 274 DWORD dwBumpDuBitMask; // mask for bump map U delta bits 275 DWORD dwOperations; // DDPF_D3DFORMAT Operations 276 } 277 union { 278 DWORD dwGBitMask; // mask for green bits 279 DWORD dwUBitMask; // mask for U bits 280 DWORD dwZBitMask; // mask for Z bits 281 DWORD dwBumpDvBitMask; // mask for bump map V delta bits 282 struct { 283 WORD wFlipMSTypes; // Multisample methods supported via flip for this D3DFORMAT 284 WORD wBltMSTypes; // Multisample methods supported via blt for this D3DFORMAT 285 } 286 287 } 288 union { 289 DWORD dwBBitMask; // mask for blue bits 290 DWORD dwVBitMask; // mask for V bits 291 DWORD dwStencilBitMask; // mask for stencil bits 292 DWORD dwBumpLuminanceBitMask; // mask for luminance in bump map 293 } 294 union { 295 DWORD dwRGBAlphaBitMask; // mask for alpha channel 296 DWORD dwYUVAlphaBitMask; // mask for alpha channel 297 DWORD dwLuminanceAlphaBitMask;// mask for alpha channel 298 DWORD dwRGBZBitMask; // mask for Z channel 299 DWORD dwYUVZBitMask; // mask for Z channel 300 } 301 } 302 alias LPDDPIXELFORMAT = DDPIXELFORMAT*; 303 304 struct DDSCAPS2 { 305 DWORD dwCaps; // capabilities of surface wanted 306 DWORD dwCaps2; 307 DWORD dwCaps3; 308 union { 309 DWORD dwCaps4; 310 DWORD dwVolumeDepth; 311 } 312 } 313 alias LPDDSCAPS2 = DDSCAPS2*; 314 315 struct DDSURFACEDESC2 { 316 DWORD dwSize; // size of the DDSURFACEDESC structure 317 DWORD dwFlags; // determines what fields are valid 318 DWORD dwHeight; // height of surface to be created 319 DWORD dwWidth; // width of input surface 320 union { 321 LONG lPitch; // distance to start of next line (return value only) 322 DWORD dwLinearSize; // Formless late-allocated optimized surface size 323 } 324 union { 325 DWORD dwBackBufferCount; // number of back buffers requested 326 DWORD dwDepth; // the depth if this is a volume texture 327 } 328 union { 329 DWORD dwMipMapCount; // number of mip-map levels requestde 330 // dwZBufferBitDepth removed, use ddpfPixelFormat one instead 331 DWORD dwRefreshRate; // refresh rate (used when display mode is described) 332 DWORD dwSrcVBHandle; // The source used in VB::Optimize 333 } 334 DWORD dwAlphaBitDepth; // depth of alpha buffer requested 335 DWORD dwReserved; // reserved 336 LPVOID lpSurface; // pointer to the associated surface memory 337 union { 338 DDCOLORKEY ddckCKDestOverlay; // color key for destination overlay use 339 DWORD dwEmptyFaceColor; // Physical color for empty cubemap faces 340 } 341 DDCOLORKEY ddckCKDestBlt; // color key for destination blt use 342 DDCOLORKEY ddckCKSrcOverlay; // color key for source overlay use 343 DDCOLORKEY ddckCKSrcBlt; // color key for source blt use 344 union { 345 DDPIXELFORMAT ddpfPixelFormat; // pixel format description of the surface 346 DWORD dwFVF; // vertex format description of vertex buffers 347 } 348 DDSCAPS2 ddsCaps; // direct draw surface capabilities 349 DWORD dwTextureStage; // stage in multitexture cascade 350 } 351 alias LPDDSURFACEDESC2 = DDSURFACEDESC2*; 352 353 mixin(uuid!(IDirectDraw7, "15e65ec0-3b9c-11d2-b92f-00609797ea5b")); 354 extern (C++) interface IDirectDraw7 : IUnknown { 355 HRESULT Compact(); 356 HRESULT CreateClipper(DWORD, LPDIRECTDRAWCLIPPER*, IUnknown); 357 HRESULT CreatePalette(DWORD, LPPALETTEENTRY, LPDIRECTDRAWPALETTE*, IUnknown); 358 HRESULT CreateSurface(LPDDSURFACEDESC2, LPDIRECTDRAWSURFACE7*, IUnknown); 359 HRESULT DuplicateSurface(LPDIRECTDRAWSURFACE7, LPDIRECTDRAWSURFACE7*); 360 HRESULT EnumDisplayModes(DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMMODESCALLBACK2); 361 HRESULT EnumSurfaces(DWORD, LPDDSURFACEDESC2, LPVOID, LPDDENUMSURFACESCALLBACK7); 362 HRESULT FlipToGDISurface(); 363 HRESULT GetCaps(LPDDCAPS, LPDDCAPS); 364 HRESULT GetDisplayMode(LPDDSURFACEDESC2); 365 HRESULT GetFourCCCodes(LPDWORD, LPDWORD ); 366 HRESULT GetGDISurface(LPDIRECTDRAWSURFACE7*); 367 HRESULT GetMonitorFrequency(LPDWORD); 368 HRESULT GetScanLine(LPDWORD); 369 HRESULT GetVerticalBlankStatus(LPBOOL); 370 HRESULT Initialize(GUID*); 371 HRESULT RestoreDisplayMode(); 372 HRESULT SetCooperativeLevel(HWND, DWORD); 373 HRESULT SetDisplayMode(DWORD, DWORD, DWORD, DWORD, DWORD); 374 HRESULT WaitForVerticalBlank(DWORD, HANDLE); 375 /*** Added in the v2 interface ***/ 376 HRESULT GetAvailableVidMem(LPDDSCAPS2, LPDWORD, LPDWORD); 377 /*** Added in the V4 Interface ***/ 378 HRESULT GetSurfaceFromDC(HDC, LPDIRECTDRAWSURFACE7*); 379 HRESULT RestoreAllSurfaces(); 380 HRESULT TestCooperativeLevel(); 381 HRESULT GetDeviceIdentifier(LPDDDEVICEIDENTIFIER2, DWORD); 382 HRESULT StartModeTest(LPSIZE, DWORD, DWORD); 383 HRESULT EvaluateMode(DWORD, DWORD*); 384 } 385 386 extern (C++) interface IDirectDrawClipper : IUnknown { 387 388 } 389 alias LPDIRECTDRAWCLIPPER = IDirectDrawClipper; 390 391 extern (C++) interface IDirectDrawPalette : IUnknown { 392 393 } 394 alias LPDIRECTDRAWPALETTE = IDirectDrawPalette; 395 396 extern (C++) interface IDirectDrawSurface7 : IUnknown { 397 398 } 399 alias LPDIRECTDRAWSURFACE7 = IDirectDrawSurface7; 400 401 extern (Windows) { 402 alias LPD3DVALIDATECALLBACK = HRESULT function(LPVOID lpUserArg, DWORD dwOffset); 403 //alias LPD3DENUMTEXTUREFORMATSCALLBACK = HRESULT function(LPDDSURFACEDESC lpDdsd, LPVOID lpContext); 404 alias LPD3DENUMPIXELFORMATSCALLBACK = HRESULT function(LPDDPIXELFORMAT lpDDPixFmt, LPVOID lpContext); 405 406 alias LPD3DENUMDEVICESCALLBACK7 = HRESULT function 407 (LPSTR lpDeviceDescription, LPSTR lpDeviceName, LPD3DDEVICEDESC7, LPVOID); 408 } 409 410 struct D3DVERTEXBUFFERDESC { 411 DWORD dwSize; 412 DWORD dwCaps; 413 DWORD dwFVF; 414 DWORD dwNumVertices; 415 } 416 alias LPD3DVERTEXBUFFERDESC = D3DVERTEXBUFFERDESC*; 417 418 alias D3DVALUE = float; 419 alias LPD3DVALUE = D3DVALUE*; 420 421 struct D3DPRIMCAPS { 422 DWORD dwSize; 423 DWORD dwMiscCaps; /* Capability flags */ 424 DWORD dwRasterCaps; 425 DWORD dwZCmpCaps; 426 DWORD dwSrcBlendCaps; 427 DWORD dwDestBlendCaps; 428 DWORD dwAlphaCmpCaps; 429 DWORD dwShadeCaps; 430 DWORD dwTextureCaps; 431 DWORD dwTextureFilterCaps; 432 DWORD dwTextureBlendCaps; 433 DWORD dwTextureAddressCaps; 434 DWORD dwStippleWidth; /* maximum width and height of */ 435 DWORD dwStippleHeight; /* of supported stipple (up to 32x32) */ 436 } 437 alias LPD3DPRIMCAPS = D3DPRIMCAPS*; 438 439 struct D3DDEVICEDESC7 { 440 DWORD dwDevCaps; /* Capabilities of device */ 441 D3DPRIMCAPS dpcLineCaps; 442 D3DPRIMCAPS dpcTriCaps; 443 DWORD dwDeviceRenderBitDepth; /* One of DDBB_8, 16, etc.. */ 444 DWORD dwDeviceZBufferBitDepth;/* One of DDBD_16, 32, etc.. */ 445 446 DWORD dwMinTextureWidth, dwMinTextureHeight; 447 DWORD dwMaxTextureWidth, dwMaxTextureHeight; 448 449 DWORD dwMaxTextureRepeat; 450 DWORD dwMaxTextureAspectRatio; 451 DWORD dwMaxAnisotropy; 452 453 D3DVALUE dvGuardBandLeft; 454 D3DVALUE dvGuardBandTop; 455 D3DVALUE dvGuardBandRight; 456 D3DVALUE dvGuardBandBottom; 457 458 D3DVALUE dvExtentsAdjust; 459 DWORD dwStencilCaps; 460 461 DWORD dwFVFCaps; 462 DWORD dwTextureOpCaps; 463 WORD wMaxTextureBlendStages; 464 WORD wMaxSimultaneousTextures; 465 466 DWORD dwMaxActiveLights; 467 D3DVALUE dvMaxVertexW; 468 GUID deviceGUID; 469 470 WORD wMaxUserClipPlanes; 471 WORD wMaxVertexBlendMatrices; 472 473 DWORD dwVertexProcessingCaps; 474 475 DWORD dwReserved1; 476 DWORD dwReserved2; 477 DWORD dwReserved3; 478 DWORD dwReserved4; 479 } 480 alias LPD3DDEVICEDESC7 = D3DDEVICEDESC7*; 481 482 mixin(uuid!(IDirect3D7, "f5049e77-4861-11d2-a407-00a0c90629a8")); 483 extern (C++) interface IDirect3D7 : IUnknown { 484 HRESULT EnumDevices(LPD3DENUMDEVICESCALLBACK7,LPVOID); 485 HRESULT CreateDevice(REFCLSID,LPDIRECTDRAWSURFACE7,LPDIRECT3DDEVICE7*); 486 HRESULT CreateVertexBuffer(LPD3DVERTEXBUFFERDESC,LPDIRECT3DVERTEXBUFFER7*,DWORD); 487 HRESULT EnumZBufferFormats(REFCLSID,LPD3DENUMPIXELFORMATSCALLBACK,LPVOID); 488 HRESULT EvictManagedTextures(); 489 } 490 alias LPDIRECT3D7 = IDirect3D7; 491 492 struct D3DCLIPSTATUS { 493 DWORD dwFlags; /* Do we set 2d extents, 3D extents or status */ 494 DWORD dwStatus; /* Clip status */ 495 float minx, maxx; /* X extents */ 496 float miny, maxy; /* Y extents */ 497 float minz, maxz; /* Z extents */ 498 } 499 alias LPD3DCLIPSTATUS = D3DCLIPSTATUS*; 500 501 enum { 502 D3DCLIPSTATUS_STATUS = 0x00000001, 503 D3DCLIPSTATUS_EXTENTS2 = 0x00000002, 504 D3DCLIPSTATUS_EXTENTS3 = 0x00000004 505 } 506 507 struct D3DVIEWPORT7 { 508 DWORD dwX; 509 DWORD dwY; /* Viewport Top left */ 510 DWORD dwWidth; 511 DWORD dwHeight; /* Viewport Dimensions */ 512 D3DVALUE dvMinZ; /* Min/max of clip Volume */ 513 D3DVALUE dvMaxZ; 514 } 515 alias LPD3DVIEWPORT7 = D3DVIEWPORT7*; 516 517 struct D3DMATERIAL7 { 518 union { 519 D3DCOLORVALUE diffuse; /* Diffuse color RGBA */ 520 D3DCOLORVALUE dcvDiffuse; 521 } 522 union { 523 D3DCOLORVALUE ambient; /* Ambient color RGB */ 524 D3DCOLORVALUE dcvAmbient; 525 } 526 union { 527 D3DCOLORVALUE specular; /* Specular 'shininess' */ 528 D3DCOLORVALUE dcvSpecular; 529 } 530 union { 531 D3DCOLORVALUE emissive; /* Emissive color RGB */ 532 D3DCOLORVALUE dcvEmissive; 533 } 534 union { 535 D3DVALUE power; /* Sharpness if specular highlight */ 536 D3DVALUE dvPower; 537 } 538 } 539 alias LPD3DMATERIAL7 = D3DMATERIAL7*; 540 541 struct D3DLIGHT7 { 542 D3DLIGHTTYPE dltType; /* Type of light source */ 543 D3DCOLORVALUE dcvDiffuse; /* Diffuse color of light */ 544 D3DCOLORVALUE dcvSpecular; /* Specular color of light */ 545 D3DCOLORVALUE dcvAmbient; /* Ambient color of light */ 546 D3DVECTOR dvPosition; /* Position in world space */ 547 D3DVECTOR dvDirection; /* Direction in world space */ 548 D3DVALUE dvRange; /* Cutoff range */ 549 D3DVALUE dvFalloff; /* Falloff */ 550 D3DVALUE dvAttenuation0; /* Constant attenuation */ 551 D3DVALUE dvAttenuation1; /* Linear attenuation */ 552 D3DVALUE dvAttenuation2; /* Quadratic attenuation */ 553 D3DVALUE dvTheta; /* Inner angle of spotlight cone */ 554 D3DVALUE dvPhi; /* Outer angle of spotlight cone */ 555 } 556 alias LPD3DLIGHT7 = D3DLIGHT7*; 557 558 struct D3DDP_PTRSTRIDE { 559 LPVOID lpvData; 560 DWORD dwStride; 561 } 562 563 enum D3DDP_MAXTEXCOORD = 8; 564 565 struct D3DDRAWPRIMITIVESTRIDEDDATA { 566 D3DDP_PTRSTRIDE position; 567 D3DDP_PTRSTRIDE normal; 568 D3DDP_PTRSTRIDE diffuse; 569 D3DDP_PTRSTRIDE specular; 570 D3DDP_PTRSTRIDE[D3DDP_MAXTEXCOORD] textureCoords; 571 } 572 alias LPD3DDRAWPRIMITIVESTRIDEDDATA = D3DDRAWPRIMITIVESTRIDEDDATA*; 573 574 mixin(uuid!(IDirect3DDevice7, "f5049e79-4861-11d2-a407-00a0c90629a8")); 575 extern (C++) interface IDirect3DDevice7 : IUnknown { 576 HRESULT GetCaps(LPD3DDEVICEDESC7); 577 HRESULT EnumTextureFormats(LPD3DENUMPIXELFORMATSCALLBACK,LPVOID); 578 HRESULT BeginScene(); 579 HRESULT EndScene(); 580 HRESULT GetDirect3D(LPDIRECT3D7*); 581 HRESULT SetRenderTarget(LPDIRECTDRAWSURFACE7,DWORD); 582 HRESULT GetRenderTarget(LPDIRECTDRAWSURFACE7 *); 583 HRESULT Clear(DWORD,LPD3DRECT,DWORD,D3DCOLOR,D3DVALUE,DWORD); 584 HRESULT SetTransform(D3DTRANSFORMSTATETYPE,LPD3DMATRIX); 585 HRESULT GetTransform(D3DTRANSFORMSTATETYPE,LPD3DMATRIX); 586 HRESULT SetViewport(LPD3DVIEWPORT7); 587 HRESULT MultiplyTransform(D3DTRANSFORMSTATETYPE,LPD3DMATRIX); 588 HRESULT GetViewport(LPD3DVIEWPORT7); 589 HRESULT SetMaterial(LPD3DMATERIAL7); 590 HRESULT GetMaterial(LPD3DMATERIAL7); 591 HRESULT SetLight(DWORD,LPD3DLIGHT7); 592 HRESULT GetLight(DWORD,LPD3DLIGHT7); 593 HRESULT SetRenderState(D3DRENDERSTATETYPE,DWORD); 594 HRESULT GetRenderState(D3DRENDERSTATETYPE,LPDWORD); 595 HRESULT BeginStateBlock(); 596 HRESULT EndStateBlock(LPDWORD); 597 HRESULT PreLoad(LPDIRECTDRAWSURFACE7); 598 HRESULT DrawPrimitive(D3DPRIMITIVETYPE,DWORD,LPVOID,DWORD,DWORD); 599 HRESULT DrawIndexedPrimitive(D3DPRIMITIVETYPE,DWORD,LPVOID,DWORD,LPWORD,DWORD,DWORD); 600 HRESULT SetClipStatus(LPD3DCLIPSTATUS); 601 HRESULT GetClipStatus(LPD3DCLIPSTATUS); 602 HRESULT DrawPrimitiveStrided(D3DPRIMITIVETYPE,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,DWORD); 603 HRESULT DrawIndexedPrimitiveStrided(D3DPRIMITIVETYPE,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,LPWORD,DWORD,DWORD); 604 HRESULT DrawPrimitiveVB(D3DPRIMITIVETYPE,LPDIRECT3DVERTEXBUFFER7,DWORD,DWORD,DWORD); 605 HRESULT DrawIndexedPrimitiveVB(D3DPRIMITIVETYPE,LPDIRECT3DVERTEXBUFFER7,DWORD,DWORD,LPWORD,DWORD,DWORD); 606 HRESULT ComputeSphereVisibility(LPD3DVECTOR,LPD3DVALUE,DWORD,DWORD,LPDWORD); 607 HRESULT GetTexture(DWORD,LPDIRECTDRAWSURFACE7 *); 608 HRESULT SetTexture(DWORD,LPDIRECTDRAWSURFACE7); 609 HRESULT GetTextureStageState(DWORD,D3DTEXTURESTAGESTATETYPE,LPDWORD); 610 HRESULT SetTextureStageState(DWORD,D3DTEXTURESTAGESTATETYPE,DWORD); 611 HRESULT ValidateDevice(LPDWORD); 612 HRESULT ApplyStateBlock(DWORD); 613 HRESULT CaptureStateBlock(DWORD); 614 HRESULT DeleteStateBlock(DWORD); 615 HRESULT CreateStateBlock(D3DSTATEBLOCKTYPE,LPDWORD); 616 HRESULT Load(LPDIRECTDRAWSURFACE7,LPPOINT,LPDIRECTDRAWSURFACE7,LPRECT,DWORD); 617 HRESULT LightEnable(DWORD,BOOL); 618 HRESULT GetLightEnable(DWORD,BOOL*); 619 HRESULT SetClipPlane(DWORD,D3DVALUE*); 620 HRESULT GetClipPlane(DWORD,D3DVALUE*); 621 HRESULT GetInfo(DWORD,LPVOID,DWORD); 622 } 623 alias LPDIRECT3DDEVICE7 = IDirect3DDevice7; 624 625 extern (C++) interface IDirect3DVertexBuffer7 : IUnknown { 626 HRESULT Lock(DWORD,LPVOID*,LPDWORD); 627 HRESULT Unlock(); 628 HRESULT ProcessVertices(DWORD,DWORD,DWORD,LPDIRECT3DVERTEXBUFFER7,DWORD,LPDIRECT3DDEVICE7,DWORD); 629 HRESULT GetVertexBufferDesc(LPD3DVERTEXBUFFERDESC); 630 HRESULT Optimize(LPDIRECT3DDEVICE7,DWORD); 631 HRESULT ProcessVerticesStrided(DWORD,DWORD,DWORD,LPD3DDRAWPRIMITIVESTRIDEDDATA,DWORD,LPDIRECT3DDEVICE7,DWORD); 632 }; 633 alias LPDIRECT3DVERTEXBUFFER7 = IDirect3DVertexBuffer7; 634 635 __gshared LPDIRECTDRAWCREATEEX DirectDrawCreateEx; 636 __gshared LPDIRECTDRAWENUMERATEEXA DirectDrawEnumerateExA; 637 638 extern (Windows) { 639 //alias LPDDENUMMODESCALLBACK = HRESULT function(LPDDSURFACEDESC, LPVOID); 640 alias LPDDENUMMODESCALLBACK2 = HRESULT function(LPDDSURFACEDESC2, LPVOID); 641 //alias LPDDENUMSURFACESCALLBACK = HRESULT function(LPDIRECTDRAWSURFACE, LPDDSURFACEDESC, LPVOID); 642 //alias LPDDENUMSURFACESCALLBACK2 = HRESULT function(LPDIRECTDRAWSURFACE4, LPDDSURFACEDESC2, LPVOID); 643 alias LPDDENUMSURFACESCALLBACK7 = HRESULT function(LPDIRECTDRAWSURFACE7, LPDDSURFACEDESC2, LPVOID); 644 645 alias LPCLIPPERCALLBACK = DWORD function(LPDIRECTDRAWCLIPPER lpDDClipper, HWND hWnd, DWORD code, 646 LPVOID lpContext); 647 648 enum { 649 DDCREATE_HARDWAREONLY = 0x00000001, 650 DDCREATE_EMULATIONONLY = 0x00000002 651 } 652 653 alias LPDIRECTDRAWCREATEEX = HRESULT function(GUID* lpGUID, 654 LPVOID* lplpDD, 655 REFIID iid, 656 IUnknown* pUnkOuter); 657 658 enum { 659 DDENUM_ATTACHEDSECONDARYDEVICES = 0x00000001 660 } 661 662 alias LPDDENUMCALLBACKEXA = BOOL function(GUID*, LPSTR, LPSTR, 663 LPVOID, HMONITOR); 664 665 alias LPDIRECTDRAWENUMERATEEXA = 666 HRESULT function(LPDDENUMCALLBACKEXA lpCallback, 667 LPVOID lpContext, 668 DWORD dwFlags); 669 }